using System;
using System.IO;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Text.RegularExpressions;


namespace EpisodeWizard.App
{

	/// <summary>
	/// Main form of the application
	/// </summary>
	public partial class MainForm : System.Windows.Forms.Form
	{

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			Application.Run(new App.MainForm());
		}


		public MainForm()
		{
			InitializeComponent();
		}


		/// <summary>
		/// Create all the wizard pages
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void frmMain_Load(object sender, EventArgs e)
		{
			if (DesignMode == false)
			{
				// Create wizard pages
				wizardEngine.Pages.Add(new WizardPages.WizardPageIntro());
				wizardEngine.Pages.Add(new WizardPages.WizardPagePlugins());
				wizardEngine.Pages.Add(new WizardPages.WizardPageSelectFiles());
				wizardEngine.Pages.Add(new WizardPages.WizardPageIdentify());
				wizardEngine.Pages.Add(new WizardPages.WizardPageQuery());
				wizardEngine.Pages.Add(new WizardPages.WizardPagePattern());
				wizardEngine.Pages.Add(new WizardPages.WizardPageRename());
				wizardEngine.Pages.Add(new WizardPages.WizardPageEnd());
				wizardEngine.Start();
			}

			// Events to update the file list
			Core.Program.GetInstance().FileListChanged += new EventHandler(MainForm_FileListChanged);
			Core.Program.GetInstance().FileListValuesChanged += new EventHandler(MainForm_FileListValuesChanged);
		}

		/// <summary>
		/// If the file list needs to be rebuilt
		/// </summary>
		private void MainForm_FileListChanged(object sender, EventArgs e)
		{
			fileTree.CreateTree();
		}

		/// <summary>
		/// If the file list needs to be updates to show new values
		/// </summary>
		private void MainForm_FileListValuesChanged(object sender, EventArgs e)
		{
			fileTree.UpdateValues();
		}

		/// <summary>
		/// When a new wizard page is shown
		/// </summary>
		private void wizardEngine_NewPage(int PageIndex, string PageTitle)
		{
		}

		private void fileTree_Load(object sender, EventArgs e)
		{

		}


	}
}
